package com.quanyan.assets.web;

import com.quanyan.api.APIResponse;
import com.quanyan.assets.service.EggsService;
import com.quanyan.common.enums.BaseEnum;
import com.quanyan.orderpay.response.mq.OrderNotifyMsg;
import com.quanyan.orderpay.response.mq.RefundNotifyMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by wmb on 2016/8/25.
 */
@RestController
@RequestMapping("/api/assets/callBack")
public class CallBackController {
    @Autowired
    private EggsService eggsService;
    @RequestMapping(value="payCallBack",method = RequestMethod.POST)
    public APIResponse<BaseEnum> payCallBack(@RequestBody OrderNotifyMsg orderNotifyMsg){
        return eggsService.payCallBack(orderNotifyMsg);
    }

    @RequestMapping(value="closeCallBack",method = RequestMethod.POST)
    public APIResponse<BaseEnum> closeCallBack(@RequestBody OrderNotifyMsg orderNotifyMsg){
        return eggsService.closeCallBack(orderNotifyMsg);
    }

    @RequestMapping(value="applyRefundCallBack",method = RequestMethod.POST)
    public APIResponse<BaseEnum> applyRefundCallBack(@RequestBody RefundNotifyMsg refundNotifyMsg){
        return eggsService.applyRefundCallBack(refundNotifyMsg);
    }

    @RequestMapping(value="refundCallBack",method = RequestMethod.POST)
    public APIResponse<BaseEnum> refundCallBack(@RequestBody RefundNotifyMsg refundNotifyMsg){
        return eggsService.refundCallBack(refundNotifyMsg);
    }
}
